Option Explicit On Option Strict On Public Class Form1 Inherits System.Windows.Forms.Form Dim numbers(200) As Double Dim numItems As Integer #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents TxtThresh As System.Windows.Forms.TextBox Friend WithEvents TxtAbove As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents BtnGo As System.Windows.Forms.Button Friend WithEvents BtnQuit As System.Windows.Forms.Button Friend WithEvents LstNums As System.Windows.Forms.ListBox Friend WithEvents Button1 As System.Windows.Forms.Button Private Sub InitializeComponent() Me.LstNums = New System.Windows.Forms.ListBox Me.Label1 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Label3 = New System.Windows.Forms.Label Me.TxtThresh = New System.Windows.Forms.TextBox Me.TxtAbove = New System.Windows.Forms.TextBox Me.Label4 = New System.Windows.Forms.Label Me.BtnGo = New System.Windows.Forms.Button Me.BtnQuit = New System.Windows.Forms.Button Me.Button1 = New System.Windows.Forms.Button Me.SuspendLayout() ' 'LstNums ' Me.LstNums.Location = New System.Drawing.Point(33, 104) Me.LstNums.Name = "LstNums" Me.LstNums.Size = New System.Drawing.Size(154, 264) Me.LstNums.TabIndex = 0 ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(87, 21) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(189, 31) Me.Label1.TabIndex = 1 Me.Label1.Text = "How Many High" ' 'Label2 ' Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.2!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.Location = New System.Drawing.Point(40, 69) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(140, 21) Me.Label2.TabIndex = 2 Me.Label2.Text = "Numbers" ' 'Label3 ' Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.2!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label3.Location = New System.Drawing.Point(260, 125) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(80, 28) Me.Label3.TabIndex = 3 Me.Label3.Text = "Threshold:" ' 'TxtThresh ' Me.TxtThresh.Location = New System.Drawing.Point(367, 125) Me.TxtThresh.Name = "TxtThresh" Me.TxtThresh.Size = New System.Drawing.Size(60, 20) Me.TxtThresh.TabIndex = 4 Me.TxtThresh.Text = "" ' 'TxtAbove ' Me.TxtAbove.Location = New System.Drawing.Point(367, 229) Me.TxtAbove.Name = "TxtAbove" Me.TxtAbove.ReadOnly = True Me.TxtAbove.Size = New System.Drawing.Size(60, 20) Me.TxtAbove.TabIndex = 6 Me.TxtAbove.Text = "" ' 'Label4 ' Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.2!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label4.Location = New System.Drawing.Point(233, 229) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(127, 28) Me.Label4.TabIndex = 5 Me.Label4.Text = "Above Threshold" ' 'BtnGo ' Me.BtnGo.Location = New System.Drawing.Point(233, 173) Me.BtnGo.Name = "BtnGo" Me.BtnGo.Size = New System.Drawing.Size(74, 35) Me.BtnGo.TabIndex = 7 Me.BtnGo.Text = "Go" ' 'BtnQuit ' Me.BtnQuit.Location = New System.Drawing.Point(327, 173) Me.BtnQuit.Name = "BtnQuit" Me.BtnQuit.Size = New System.Drawing.Size(73, 35) Me.BtnQuit.TabIndex = 8 Me.BtnQuit.Text = "Quit" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(296, 64) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(88, 32) Me.Button1.TabIndex = 9 Me.Button1.Text = "GoInClass" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(579, 465) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.BtnQuit) Me.Controls.Add(Me.BtnGo) Me.Controls.Add(Me.TxtAbove) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.TxtThresh) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.LstNums) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) End Sub #End Region Private Sub BtnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnQuit.Click Me.Close() End Sub Private Sub BtnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGo.Click Dim thresh As Double Dim howMany As Integer = 0 If IsNumeric(TxtThresh.Text) Then thresh = Convert.ToDouble(TxtThresh.Text) Dim cnt As Integer For cnt = 0 To numItems If numbers(cnt) > thresh Then howMany = howMany + 1 End If Next TxtAbove.Text = howMany.ToString("n0") Else MsgBox("threshold must be numeric") End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim inpf As IO.StreamReader If IO.File.Exists("numbers.txt") Then inpf = IO.File.OpenText("numbers.txt") Do While inpf.Peek <> -1 And numItems <= 200 Dim curr As Double Dim currStr As String currStr = inpf.ReadLine() curr = Convert.ToDouble(currStr) numbers(numItems) = curr numItems = numItems + 1 LstNums.Items.Add(currStr) Loop End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cnt As Integer Dim thresh As Double Dim numAbove As Integer = 0 If IsNumeric(TxtThresh.Text) Then thresh = Convert.ToDouble(TxtThresh.Text) For cnt = 0 To numItems - 1 If numbers(cnt) > thresh Then numAbove = numAbove + 1 End If Next TxtAbove.Text = numAbove.ToString("n0") Else MsgBox("yo! enter a number ok!!!") End If End Sub End Class